<?php

use Fisharebest\Webtrees\I18N;

?>

<h2 class="wt-page-title"><?= $title ?></h2>

<p>
    <?= I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.') ?>
</p>

<?php if ($records === []) : ?>
<p>
    <?= I18N::translate('Your clippings cart is empty.') ?>
</p>
<?php else : ?>
    <table class="table wt-facts-table">
        <thead>
            <tr>
                <th><?= I18N::translate('Record') ?></th>
                <th><?= I18N::translate('Remove') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($records as $record) : ?>
                <tr>
                    <td>
                        <?= view('icons/record', ['record' => $record]) ?>

                        <a href="<?= e($record->url()) ?>">
                            <?= $record->fullName() ?>
                        </a>
                    </td>
                    <td>
                        <form method="post" action="<?= e(route('module', ['module' => 'clippings', 'action' => 'Remove', 'tree' => $tree->name(), 'xref' => $record->xref()])) ?>">
                            <?= csrf_field() ?>
                            <button type="submit" class="btn btn-link" title="<?= I18N::translate('Remove') ?>">
                                <?= view('icons/delete') ?>
                            </button>
                        </form>
                    </td>
                </tr>
            <?php endforeach ?>
        </tbody>
    </table>
<?php endif ?>
